import { defineAsyncComponent } from 'vue';

const SGInput = defineAsyncComponent(() => import('../sg-input/index.vue'));
const SGSelect = defineAsyncComponent(() => import('../sg-select/index.vue'));
const SGLoadSelect = defineAsyncComponent(() => import('../sg-load-select/index.vue'));
const SGDate = defineAsyncComponent(() => import('../sg-date-picker/index.vue'));

export const componentMap = {
    input: SGInput,
    select: SGSelect,
    loadselect: SGLoadSelect,
    date: SGDate,
    slot: { render: () => null } as Component, // 表示一个空渲染组件
    interval: { render: () => null } as Component // 表示一个空渲染组件
};

export type ComponentType = keyof typeof componentMap;

export const getComponent = (type: ComponentType) => componentMap[type];
